//package com.liuguang.testassert.security;
//
//import com.liuguang.testassert.filter.MyFilter;
//import com.liuguang.testassert.security.getFilterIntercepter.MyAccessDecisionManager;
//import com.liuguang.testassert.security.getFilterIntercepter.MySecurityMetadasource;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Configurable;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.ProviderManager;
//import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.authentication.configuration.EnableGlobalAuthentication;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.builders.WebSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.security.web.FilterChainProxy;
//import org.springframework.security.web.access.intercept.DefaultFilterInvocationSecurityMetadataSource;
//import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
//
///**
// * @ClassName: MySecurityConfig
// * @Description：
// * @Author: wanghr
// * Date: 2:47 PM 2020/6/1
// * Version: 1.0
// */
//@Configuration
//@EnableGlobalMethodSecurity(securedEnabled = true)
//@EnableWebSecurity
//public class MySecurityConfig extends WebSecurityConfigurerAdapter {
//    @Autowired
//    private MyAuthenticationEntryPoint myAuthenticationHandler;
//    @Autowired
//    private MyAccessDeniedHandler myAccessDeniedHandler;
////    @Autowired
////    private UserDetailsService userDetailsService;
//    @Autowired
//    private MyFilter myFilter;
//    @Autowired
//    private MySecurityMetadasource mySecurityMetadasource;
//    @Autowired
//    private MyAccessDecisionManager myAccessDecisionManager;
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http.exceptionHandling()
//                .authenticationEntryPoint(myAuthenticationHandler)
//                .accessDeniedHandler(myAccessDeniedHandler)
//                .and()
//             .authorizeRequests()
//                .antMatchers("/sc/userEnroll").permitAll()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin().and();
//        MyFilterIntercepter myFilterIntercepter = new MyFilterIntercepter(mySecurityMetadasource,
//                myAccessDecisionManager,authenticationManagerBean());
//        http.addFilterBefore(myFilter, UsernamePasswordAuthenticationFilter.class);
////        http.addFilterAt(myFilterIntercepter,FilterSecurityInterceptor.class);
//    }
//
//
//    @Override
//    public AuthenticationManager authenticationManagerBean() throws Exception {
//        return super.authenticationManagerBean();
//    }
//
//    @Override
//    public void configure(WebSecurity web) throws Exception {
//        super.configure(web);
//    }
//
//    @Override
//    public UserDetailsService userDetailsServiceBean() throws Exception {
//        return super.userDetailsServiceBean();
//    }
//}
